
<style>
.ishidden{
display:none;
}

</style>
<form id="form1" name="form1" class="easyui-form" method="post" data-options="novalidate:true" action ="">
<table id="mytable" cellpadding="5" border="0">
<tr><td>
<?php
$i	=	0;
foreach($notary_matter_para  as $row) {
	if($row["single_select"] ==1){
		if($i == 0){
			echo '<input name="single_select" 		value="'.$row["id"].'" type="radio" checked onclick="myselect(this,'.$row["id"].')"/>'.$row["name"];
		}else{
			echo '<input name="single_select" 		value="'.$row["id"].'" type="radio" onclick="myselect(this,'.$row["id"].')"/>'.$row["name"];
		}
		$i++;
	}

}
?>

</td></tr>
<?php
$i	=	0;
foreach($notary_matter_para  as $row) {
	if($row["single_select"] ==1){

		$para = array();
			if($row["field"] !=""){
				$para = unserialize($row["field"]);
			}
			foreach($para  as $arr){
					if($i ==0)  {
						echo '<tr id="s'.$row["id"].'"  class="single_select s'.$row["id"].'"><td>'.$arr["text"].':</td><td><input  class="single_select s'.$row["id"].'" name="'.$row["name"].'|'.$arr["text"].'" type ="text"></td></tr>';
					}else{
						echo '<tr  id="s'.$row["id"].'" class="single_select s'.$row["id"].' ishidden"><td>'.$arr["text"].':</td><td><input  class="single_select s'.$row["id"].' ishidden" name="'.$row["name"].'|'.$arr["text"].'" type ="text" disabled="disabled"></td></tr>';
					}
			}
			if($notary_matter["is_person"] ==1){
				foreach($person  as $key=>$val){
					if($i ==0)  {
						echo '<tr id="'.$row["id"].'"  class="single_select s'.$row["id"].'"><td>'.$val.':</td><td><input  class="single_select s'.$row["id"].'" name="'.$row["name"].'|'.$val.'" type ="text" ></td></tr>';
					}else{
						echo '<tr id="'.$row["id"].'"  class="single_select s'.$row["id"].' ishidden" ><td>'.$val.':</td><td><input  class="single_select s'.$row["id"].' ishidden" name="'.$row["name"].'|'.$val.'" type ="text"  disabled="disabled"></td></tr>';
					}

				}
			}

		$i++;

	}
}
?>



</table>
<table id="mytable" cellpadding="5" border="0">
<tr><td>
<?php
$i	=	0;
foreach($notary_matter_para  as $row) {
	if($row["single_select"] ==0){
		if($i == 0){
			echo '<input name="muti_select" 		value="'.$row["id"].'" type="checkbox" checked onclick="mutiselect(this,'.$row["id"].')"/>'.$row["name"];
		}else{
			echo '<input name="muti_select" 		value="'.$row["id"].'" type="checkbox" onclick="mutiselect(this,'.$row["id"].')"/>'.$row["name"];
		}
		$i++;
	}

}
?>
</td></tr>
<?php
$i	=	0;
foreach($notary_matter_para  as $row) {
	if($row["single_select"] !=1){

		$para = array();
			if($row["field"] !=""){
				$para = unserialize($row["field"]);
			}
			foreach($para  as $arr){
					if($i ==0)  {
						echo '<tr id="m'.$row["id"].'"  class="m'.$row["id"].'"><td>'.$arr["text"].':</td><td><input  class="m'.$row["id"].'" name="'.$row["name"].'|'.$arr["text"].']" type ="text"></td></tr>';
					}else{
						echo '<tr  id="m'.$row["id"].'" class="m'.$row["id"].' ishidden"><td>'.$arr["text"].':</td><td><input  class="m'.$row["id"].' ishidden" name="'.$row["name"].'|'.$arr["text"].'" type ="text" disabled="disabled"></td></tr>';
					}

			}
			if($notary_matter["is_person"] ==0){
				foreach($person  as $key=>$val){
					if($i ==0)  {
						echo '<tr id="'.$row["id"].'"  class=""><td>'.$val.':</td><td><input  class="m'.$row["id"].'" name="'.$row["name"].'|'.$val.'" type ="text" ></td></tr>';
					}else{
						echo '<tr id="'.$row["id"].'"  class=" ishidden" ><td>'.$val.':</td><td><input  class="m'.$row["id"].' ishidden" name="'.$row["name"].'|'.$val.'" type ="text"  disabled="disabled"></td></tr>';
					}

				}
			}

		$i++;
	}
}
?>

</table>
</form>

<a href="javascript:void(0)" class="easyui-linkbutton c9" style="width:80%" onclick="submitForm()">添 加</a>

<script>

function myselect(obj,id) {

		//alert($(obj).val());
		 $(".single_select").each(function(){
	    		$(this).addClass("ishidden");
	    		$(this).attr("disabled","disabled");
	  	});
	  	 $(".s"+id).each(function(){
	    		$(this).removeClass("ishidden");
	    		$(this).removeAttr("disabled");
	  	});

}

function mutiselect(obj,id) {

	$(".m"+id).toggle();
    if(!$(obj).is(":checked")){
	    $(".m"+id).each(function(){
	    		$(this).attr("disabled","disabled");
	  	});
    }else{
    	 $(".m"+id).each(function(){
	    		$(this).removeAttr("disabled");
	  	});
    }
}

	function submitForm(){

       					$('#form1').form('submit',{
							onSubmit:function(){

									var url = "<?php echo $action_url ?>";
								     $.ajax({
										   type: "POST",
										   url:url,
										   dataType:"text",
										   data:$("#form1").serialize(),
										   success: function(msg){
													alert(msg);

										   }
									});


							}
					 	});


		}

</script>